<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <div>
            <router-link to="/indx">首页</router-link>
            <router-link to="/product">商城</router-link>
            <router-view></router-view>
        </div>
    </div>
</body>

<script src="./node_modules/vue/dist/vue.js"></script>
<script src="./node_modules/vue-router/dist/vue-router.js"></script>

<script>
    let index= Vue.component("index", {
        template:`<div>hello,欢迎来到首页</div>`
    });
    let product=Vue.component("product", {
        template:`<div>hello,欢迎来到猪猪侠商城</div>`
    });

    //使用路由管理模版，将url跟模版进行绑定
    const router = new VueRouter({
        routes: [
            {
                path:"/indx",
                component:index
            },
            {
                path:"/product",
                component:product
            }
        ]
    })

    var vm=new Vue({
        el:"#app",
        router
    })
</script>
</html>